<?php
$string = 'Weekend  php';
$length = 0;
//$length = strlen($string);
for($j=0 ;  ; $j++){
  if(!isset($string[$j]))
  break;
  $length++;
}
for ($i=($length-1) ; $i >= 0 ; $i--) {
  echo $string[$i];
}
//php dnekeeW
